namespace Runtime
{
    public class temp
    {
        
    }
}
/*
 *
 *
 * using UnityEngine;
using UnityEditor;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;

[ExecuteAlways]
public class Gen_Irradiance_Map : MonoBehaviour
{
    public ComputeShader shader;
   
    public Cubemap envCube;

    private void Start()
    {
        //Bake_Irradiance_Map(envCube);
    }

    private void OnEnable()
    {
        //Bake_Irradiance_Map(envCube);
        RunShader();
    }
    public static Cubemap GetCubeMapByCubeTexture2D(Texture2DArray tempTex)
    {
        
        int cubeMapSize = tempTex.width;
        Cubemap cubemap = new Cubemap(cubeMapSize, TextureFormat.RGB24, false);
        for (int i = 0; i < 6; i++)
        {
            var color=tempTex.GetPixels(i, 0);
            
            //cubemap.SetPixels(tempTex.GetPixels(cubeMapSize, 0, cubeMapSize, cubeMapSize), CubemapFace.PositiveY);
            cubemap.SetPixels(color, CubemapFace.PositiveX+i);
        }
        
       
        cubemap.Apply();
        return cubemap;
    }
    void RunShader()
    {
        int kernelHandle = shader.FindKernel("CSMain");

        // var tex = new RenderTexture(256, 256,0,RenderTextureFormat.ARGB32);
        // tex.enableRandomWrite = true;
        // tex.Create();
        int width = envCube.width;
        if (width == 0)
        {
            Debug.Log("error width");
        }
        var texarr = new RenderTexture(width, width,0,RenderTextureFormat.ARGB32);
        
        texarr.enableRandomWrite = true;
        texarr.dimension = TextureDimension.Tex2DArray;
        texarr.volumeDepth = 6;
        texarr.Create();
        var texcube = new RenderTexture(width, width,0,RenderTextureFormat.ARGB32);
        texcube.enableRandomWrite = true;
        texcube.dimension = TextureDimension.Tex3D;
        texcube.volumeDepth = 6;
        texcube.Create();
        var assettex = new Texture2DArray(width, width, 6, TextureFormat.ARGB32, false);
        
        assettex.Apply();
        
        

       
        assettex.Apply();
        //shader.SetTexture(kernelHandle, "Result", tex);
        shader.SetTexture(kernelHandle, "re_arr", texarr);
        shader.SetTexture(kernelHandle, "cube_map", envCube);
        shader.SetTexture(kernelHandle, "re_cube", texcube);
        shader.Dispatch(kernelHandle, width / 8, width / 8, 1);
        //AssetDatabase.CreateAsset(tex, "Assets/HDRS/irr.renderTexture");
        AssetDatabase.CreateAsset(texarr, "Assets/HDRS/irrarr.renderTexture");
        AssetDatabase.CreateAsset(texcube, "Assets/HDRS/texcube.renderTexture");
        AssetDatabase.CreateAsset(assettex, "Assets/HDRS/assettex.asset");
        AssetDatabase.Refresh();
    }

  
    void Bake_Irradiance_Map(Cubemap cubemap)
    {
        int kernelHandle = shader.FindKernel("Pre_Irradiance");
        int width = cubemap.width;
        var Irradiance_Map = new RenderTexture(width, width,GraphicsFormat.R16G16B16A16_SFloat, 0);
       
        
        Irradiance_Map.dimension = UnityEngine.Rendering.TextureDimension.Tex2DArray;
        Irradiance_Map.volumeDepth = 6;
        Irradiance_Map.enableRandomWrite = true;
        Irradiance_Map.Create();
        shader.SetTexture(kernelHandle, "cube_map", cubemap);
        shader.SetTexture(kernelHandle, "irradiance_map", Irradiance_Map);

        shader.Dispatch(kernelHandle, width/4, width/4, 6);
        Texture2DArray textures2DArray = new Texture2DArray(width, width, 6, GraphicsFormat.R16G16B16A16_SFloat, 0);
        Graphics.CopyTexture(Irradiance_Map, textures2DArray);
        
        textures2DArray.Apply();
        
         AssetDatabase.CreateAsset(Irradiance_Map, "Assets/HDRS/irr.renderTexture");
        // AssetDatabase.Refresh();
    }

    


    
    

}

 */